﻿using System;
using System.Collections;

namespace Vbyte.SharpOrm
{
    /// <summary>
    /// Sql主键配置
    /// </summary>
    public class SqlPrimaryKey : CollectionBase
    {
        private SqlPrimaryKey()
            : base()
        { }

        /// <summary>
        /// Initializes a new instance of the <see cref="SqlPrimaryKey"/> class.
        /// </summary>
        /// <param name="keyFieldNames">The key field names.</param>
        public SqlPrimaryKey(string keyFieldNames)
        {
            if (keyFieldNames.Contains(","))
            {
                foreach (string k in keyFieldNames.Split(','))
                {
                    this.InnerList.Add(k);
                }
            }
            else
            {
                this.Key = keyFieldNames;
                this.InnerList.Add(keyFieldNames);
            }
        }

        /// <summary>
        /// 单个主键名称
        /// </summary>
        public string Key { get; set; }
    }
}